/**
 * <b>项目名称：</b>网络应用框架<br/>
 * <b>包    名：</b>com.hhwy.framework.common<br/>
 * <b>文 件 名：</b>Parameter.java<br/>
 * <b>版本信息：</b><br/>
 * <b>日    期：</b>2014年7月23日-下午3:46:31<br/>
 * <b>Copyright (c)</b> 2014恒华伟业科技股份有限公司-版权所有<br/>
 * 
 */
package com.hhwy.framework.common;

import java.util.Locale;
import java.util.Map;

import com.hhwy.framework.configure.ConfigHelper;

 /**
 * <b>类 名 称：</b>Parameter  <br/>
 * <b>类 描 述：</b>公有变量，请求线程相关参数<br/>
 * <b>创 建 人：</b>Administrator<br/>
 * <b>修 改 人：</b>Administrator<br/>
 * <b>修改时间：</b>2014年7月23日 下午3:46:31<br/>
 * <b>修改备注：</b><br/>
 * @version 1.0.0<br/>
 */
public class Parameter {
	/**
	 * SessionId 从请求中获取的sessionid
	 */
	public static final ThreadLocal<String> session = new ThreadLocal<String>();
	public static final ThreadLocal<String> userId = new ThreadLocal<String>();
	public static final ThreadLocal<String> pluginName = new ThreadLocal<String>();
	public static final ThreadLocal<Map<String,String[]>> requestParams = new ThreadLocal<>();
	public static final ThreadLocal<Locale> locale = new ThreadLocal<Locale>();
	public static final ThreadLocal<Boolean> isFilterData = new ThreadLocal<Boolean>();
	public static final ThreadLocal<String> dataFilterName = new ThreadLocal<String>();
	public static final ThreadLocal<String> filterUserId = new ThreadLocal<String>();
	
	private static final ThreadLocal<String> basePath = new ThreadLocal<String>();
	private static final ThreadLocal<String> servletPath = new ThreadLocal<String>();
	private static String title = null;
	
	

	/**
	 * getBasePath(获取应用的根路径)<br/>
	 * @return 
	 * String
	 * @exception 
	 * @since  1.0.0
	 */
	public static String getBasePath() {
		return basePath.get();
	}


	/**
	 * @param basePath the basePath to set
	 */
	
	public static void setBasePath(String basePath) {
		Parameter.basePath.set(basePath);
	}

	public static String getServletPath() {
		return Parameter.servletPath.get();
	}

	public static void setServletPath(String servletPath) {
		Parameter.servletPath.set(servletPath);
	}


	/**
	 * title
	 * @return  the title
	 * @since   1.0.0
	 */
	
	public static String getTitle() {
		
		if(title != null)
			return title;
		else
			return ConfigHelper.getConfig("systemTitle");
	}


	/**
	 * @param title the title to set
	 */
	
	public static void setTitle(String title) {
		Parameter.title = title;
	}


	/**
	 * 
	 * basePath(获取静态文件URL)<br/>
	 * @return 
	 * String
	 * @exception 
	 * @since  1.0.0
	 */
	public static String staticPath(){
		
		return ConfigHelper.getConfig("STATIC.FILE.URL"); 
	}
}
